package modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;

/**
 *
 * @author SCHETTINO
 */
@Entity
@SequenceGenerator(name = "Sequencia", sequenceName = "seq_turma")
public class Turma implements Serializable {

    @Id
    @GeneratedValue(generator = "Sequencia", strategy = GenerationType.AUTO)
    private Long id;
    @Column(nullable = false)
    private String semestre;
    @Column(nullable = false)
    private String ano;
    private String nomeProfessor;
    @ManyToOne
    private Disciplina disciplina;
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "turma")
    private List<AlunoTurma> listaAlunoTurma;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSemestre() {
        return semestre;
    }

    public void setSemestre(String semestre) {
        this.semestre = semestre;
    }

    public String getAno() {
        return ano;
    }

    public void setAno(String ano) {
        this.ano = ano;
    }

    public String getNomeProfessor() {
        return nomeProfessor;
    }

    public void setNomeProfessor(String nomeProfessor) {
        this.nomeProfessor = nomeProfessor;
    }

    public List<AlunoTurma> getListaAlunoTurma() {
        return listaAlunoTurma;
    }

    public void setListaAlunoTurma(List<AlunoTurma> listaAlunoTurma) {
        this.listaAlunoTurma = listaAlunoTurma;
    }

    public Disciplina getDisciplina() {
        return disciplina;
    }

    public void setDisciplina(Disciplina disciplina) {
        this.disciplina = disciplina;
    }

    @Override
    public String toString() {
        return disciplina.getNome();
    }
}
